<?php
class addAction extends rareAction{
	public function execute(){}
	public function executePost(){
		$userName = $this->getPostParam('userName','');
		$passwd1 = $this->getPostParam('passwd1','');
		$passwd2 = $this->getPostParam('passwd2','');
		if($userName=='admin'){
			jsonReturn(0,'不可添加此管理员');
		}
      
		if($userName!=''&&$passwd1==$passwd2&&$passwd1!=''&&$passwd2!=''){
			$dao = new DaoAdmin();
			$user = $dao->getOne(" name='{$userName}'");
			if(!empty($user)){
				jsonReturn(0,'此管理员已存在');
			} 
			$dao->insert(array('name'=>$userName,'password'=>md5($passwd1)));
			jsonReturn(1,'ok');
		}
        
		jsonReturn(0,'请重新操作');
	}
}
?>
